package com.xzz.feignFallback;

import com.xzz.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import com.xzz.feign.CourseFeignClient;

@Component
public class CourseFeignClientFallbackFactory implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseFeignClient() {
            @Override
            public JSONResult orderInfo(String courseIds) {
                throwable.printStackTrace();
                return JSONResult.error("服务不可用不可用");
            }
        };
    }
}